#ifndef _H_ADC_
#define _H_ADC_
#include "define.h"
#include "filter.h"


#define P_EXTERNAL_1_CLK		 RCC_AHB1Periph_GPIOA
#define P_EXTERNAL_1_PORT	        GPIOA
#define P_EXTERNAL_1_PIN		GPIO_Pin_0
#define P_EXTERNAL_1_SOURCE    GPIO_PinSource0
#define ADC_TIMER TIM4
#define ADC_DMA_BUFFSIZE 6000
typedef struct{
	U8 start;
	U16 pr;
	U16 arr;
	float samplerate;
	float freq;
	U16 samplesize;
	U16 adc_dma_buff[ADC_DMA_BUFFSIZE];
	U16 periodcount;
}adc_regs_typedef;
extern adc_regs_typedef g_adc_regs;
extern void fnADC_Init(void);
extern U8 fnADC_IsFinish(void);
extern void adc_startsample(U32 freq, U32 periodcount);
extern void adc_startsampleex(U32 freq, U32 periodcount);
extern void adc_stop(void);
extern void adc_sample_byfs(float fs, U32 samples, float *rfs, U32 *rsamples);
#define  adc_timeren() ADC_TIMER->CR1 |= TIM_CR1_CEN;


#endif
